#if !defined(CAMERA_H)
#define CAMERA_H

#include "nodeworldobject.h"
#include "../../core/resources/resourceeffectvariables.h"

namespace gunsmith
{
/*! \class CNodeCamera
	\brief Class controlling the camera. */
class CNodeCamera : public CNodeWorldObject
{
public:
					CNodeCamera		(float fFieldOfView, float fAspect, float fNear, float fFar, IDirect3DDevice9* pDevice);
	virtual			~CNodeCamera	();
	void			AttachTo		(const CNodeWorldObject *pWorldObject);
	void			Detach			();
	virtual void	Draw			();
	void			DropFocus		();
	void			FocusOn			(const CNodeWorldObject *pWorldObject);
	void			LookAt			(const D3DXVECTOR3& vLookAt);
	void			SetAspect		(float fAspect);
	void			SetFieldOfView	(float fFieldOfView);
	void			SetPlanes		(float fNear, float fFar);
	virtual void	SetPosition		(const D3DXVECTOR3& vPosition);
	virtual void	SetUp			(const D3DXVECTOR3& vUp);
	virtual void	Update			(float fDelta, void *pData = NULL);

protected:
	void	UpdateAttributes();

	bool						m_bAttachedToObject;
	bool						m_bLooksAtObject;
	float						m_fAspect;
	float						m_fFar;
	float						m_fFieldOfView;
	float						m_fNear;
	D3DXMATRIX					m_matProjection;
	D3DXMATRIX					m_matView;
	D3DXVECTOR3					m_vUp;
	D3DXVECTOR3					m_vLookAt;
	const CNodeWorldObject		*m_pObjectLookedAt;
	const CNodeWorldObject		*m_pObjectAttachedTo;
	CResourceEffectVariables	*m_ResEVars;
	TEffectVariable				m_xViewMatrix;
	TEffectVariable				m_xProjectionMatrix;
};
};

#endif //CAMERA_H